<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%
  String path = request.getContextPath();
  String basePath = request.getScheme() + "://"
      + request.getServerName() + ":" + request.getServerPort()
      + path + "/";
%>


<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<meta name="description" content="">
<meta name="author" content="">

<title>购物车</title>

<!-- Bootstrap core CSS -->
<link href="<%=basePath %>css/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="<%=basePath %>css/designer.css" rel="stylesheet">

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
<script type="text/javascript" src="<%=basePath%>js/jquery-1.10.2.min.js"></script>
</head>

<body>
  <script type="text/javascript" src="<%=basePath%>js/wz_tooltip.js"></script>
  <div class="container">
    <div class="row">
      <div class="col-md-2">
        <h3>购物车</h3>
      </div>
      <div class="col-md-2 col-md-offset-6">
        <a class="btn btn-block btn-info" href="/designer/chooseProduct"><span class="glyphicon glyphicon-triangle-left" aria-hidden="true"></span>&nbsp;继续添加商品</a>
      </div>
      <div class="col-md-2 ">
        <a class="btn btn-block btn-success" href="/designer/createOrder"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span>&nbsp;生成订单</a>
      </div>
    </div>
    <c:forEach items="${sessionCar.getSessionCatalogs() }" var="catalog" varStatus="s">
      <div class="row">
        <div class="panel panel-primary">
          <div class="panel-heading">${catalog.name }</div>
          <div class="panel-body">
            <c:if test="${catalog.sessionItems.size() > 0 }">
              <table class="table table-bordered table-striped">
                <thead>
                  <tr>
                    <c:if test="${catalog.c_id == 9 }">
                      <th>名称</th>
                    </c:if>
                    <c:if test="${catalog.c_id != 9 }">
                      <th>图片</th>
                      <th>品牌</th>
                      <th>型号</th>
                      <th>规格</th>
                      <th>材质</th>
                    </c:if>
                    <th>单位</th>
                    <c:if test="${sessionScope.xlf_planType == '4' }">
                      <th>价格</th>
                    </c:if>
                    <th>数量</th>
                    <th>使用位置</th>
                    <th>备注</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                  <c:forEach items="${catalog.sessionItems }" var="itemMap" varStatus="s">
                    <tr>
                      <c:if test="${catalog.c_id == 9 }">
                        <td>${itemMap.value.brand }</td>
                      </c:if>
                      <c:if test="${catalog.c_id != 9 }">
                        <td>
                        <a href="#" onmouseover="TagToTip('span${itemMap.value.p_id }');" onmouseout="UnTip();"><img src="<%=basePath%>upload/${itemMap.value.pic }" border="0" class="product_img"/></a>
                        <span id="span${itemMap.value.p_id }">
                          <img src="<%=basePath%>upload/${itemMap.value.pic }" width="196px" height="196px">
                        </span>
                        </td>
                        <td>${itemMap.value.brand }</td>
                        <td>${itemMap.value.type }</td>
                        <td>${itemMap.value.spec }</td>
                        <td>${itemMap.value.material }</td>
                      </c:if>
                      <td>${itemMap.value.unit }</td>
                      <c:if test="${sessionScope.xlf_planType == '4' }">
                        <td>${itemMap.value.price }</td>
                      </c:if>
                      <td>${itemMap.value.count }</td>
                      <td>${itemMap.value.location }</td>
                      <td>${itemMap.value.itemRemark }</td>
                      <td><a class="btn btn-sm btn-primary" href="/designer/deleteItem?cid=${itemMap.value.c_id }&pid=${itemMap.value.p_id }" onClick="return confirm('确定移除此商品?');"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span>&nbsp;移除</a>
                      </td>
                    </tr>
                  </c:forEach>
                </tbody>
              </table>
            </c:if>
          </div>
        </div>
      </div>
    </c:forEach>

    <div class="row">
      <div class="col-md-2 col-md-offset-8">
        <a class="btn btn-block btn-info" href="/designer/chooseProduct"><span class="glyphicon glyphicon-triangle-left" aria-hidden="true"></span>&nbsp;继续添加商品</a>
      </div>
      <div class="col-md-2 ">
        <a class="btn btn-block btn-success" href="/designer/createOrder"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span>&nbsp;生成订单</a>
      </div>
    </div>
  </div>

  <!-- /container -->
</body>

</html>